/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package UI;

import BO.Controller;
import java.util.ArrayList;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

/**
 *
 * @author Ymmot
 */
@ManagedBean(name="user")
@SessionScoped
public class SearchBean {
    private Controller controller;
    private String search;
    

    /** Creates a new instance of Test */
    public SearchBean() {
        controller = new Controller();
        search = "";
    }

    public void setSearch(String search){
        this.search = search;
    }
    
    public String getSearch(){
        return search;
    }
    
    public List<UserView> getUsers(){
        if(!search.equals(""))
            return controller.findUsers(search);
        return new ArrayList<UserView>();
    }
}
